package com.jh.user.business;

import cn.jh.common.exception.ServiceException;
import com.jh.user.pojo.FastSilverPicPathRequest;
import com.jh.user.pojo.Platform;
import com.jh.user.pojo.ShopRegister;
import org.jetbrains.annotations.NotNull;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.sql.SQLException;

import java.util.Date;
import java.util.List;
import java.util.Map;


public interface ShopRegisterBussiness {

    Page<ShopRegister> findByWhere(String shopid, String shopname, String phone, Integer status,Pageable pageable);

    Page<ShopRegister> findByShopIdAndLegalNameAndCreateTimeLessThanAndCreateTimeGreaterThan(String shopId, String legalName, String startTime, String endTime, Integer status, Pageable pageable);

    Map<String, Object> findShopRegisterByWheres(String shopId,String shopName,String phone,Date startTime, long brandId,String preUserPhone,Pageable pageable);

    ShopRegister mergeShopRegister(ShopRegister shopRegister) throws ServiceException;

    ShopRegister findById(Long id);

    ShopRegister findByShopId(String shopId);

    ShopRegister findShopRegisterByShopId(String shopId);

    ShopRegister update(ShopRegister shopRegister) throws ServiceException;

    void updateShopRegister(ShopRegister shopRegister) throws SQLException;

    /**
     * 关联商户的支付配置信息
     *
     * @param shopId 商户id
     * @param alipayAppId 支付宝关联appId
     * @param wechatAppId 微信关联appId
     * @return 返回商户注册信息
     * @throws ServiceException 业务处理异常时抛出
     */
    ShopRegister updateShopPayConfigure(@NotNull String shopId, String alipayAppId, String wechatAppId) throws ServiceException;

    /**
     * 补充同步支付配置
     *
     * @param shopId 商户id
     * @param alipayAppId 支付宝id
     * @param wechatAppId 微信id
     */
    ShopRegister supplyShopPayConfigure(@NotNull String shopId, String alipayAppId, String wechatAppId) throws ServiceException;

    void verify(Long id, Integer status);

    ShopRegister findByUserId(Long userId);

    /**
     * 根据台码查询指定商户信息
     *
     * @param platformCode 台码
     * @return 返回指定商户信息
     */
    ShopRegister findShopRegister(String platformCode);

    /**
     * 根据台码查询指定商户信息并验证是否开通的支付渠道
     *
     * @param platformCode 台码
     * @param channel 支付渠道
     * @return 返回指定商户信息
     */
    ShopRegister findShopRegister(String platformCode, String channel) throws ServiceException;

    ShopRegister queryShopRegister(Platform platform);

    List<ShopRegister> findShopRegistersByAgentPhone(String agentPhone);

    ShopRegister findByMobilePhone(String mobilePhone) throws ServiceException;

    ShopRegister saveShopRegister(ShopRegister shopRegister);

    String getUsernInfoByShopRegister(long userId, String shopName, String shopPhone) throws ServiceException;

    ShopRegister getByShopId(long userId, String merchantNo);

    Map<String, String> getShopRegisterByShopId(String shopId) throws ServiceException;

    Map<String, Object> getShopRegisterByUserId(long userId) throws ServiceException;

    Map<String, Object> queryByMobilePhone(String mobilePhone) throws ServiceException;

    Map<String, Object> manageBankgroundPurchase(ShopRegister shopRegister, FastSilverPicPathRequest sfppRequest) throws ServiceException;
}
